<template>
  <div>
    <el-form :inline="true" :model="rechargeform" class="demo-form-inline">
      <el-form-item label="患者姓名">
        <el-input v-model="rechargeform.patientname" placeholder="请输入患者姓名"></el-input>
      </el-form-item>
      <el-form-item label="医生姓名">
        <el-input v-model="rechargeform.doctorname" placeholder="请输入医生姓名"></el-input>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="rechargeform.startTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择起始日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
    <el-button @click="newrecharge">充值</el-button>
    <el-table :data="rechargeList">
      <el-table-column label="患者姓名" prop="patientname" align="center"></el-table-column>
      <el-table-column label="医生姓名" prop="doctorname"align="center"></el-table-column>
      <el-table-column label="充值金额" prop="money"align="center"></el-table-column>
      <el-table-column label="充值方式" prop="way"align="center"></el-table-column>
      <el-table-column label="充值时间" prop="date"align="center"></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button @click="deleteStudent(scope.row.id)">删除</el-button>
          <el-button @click="update(scope.row)">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="30%">
      <el-input type="hidden" v-model="recharge.id"></el-input>
      <el-input type="hidden" v-model="recharge.doctorname"></el-input>
      患者名称：<el-input type="text" v-model="recharge.patientname" style="width: 300px"></el-input><br><br>
      充值金额：<el-input type="text" v-model="recharge.money"style="width: 300px"></el-input><br><br>
      充值方式：<el-input type="text" v-model="recharge.status"style="width: 300px"></el-input><br><br>
      手机号码：<el-input type="text" v-model="recharge.phone"style="width: 300px"></el-input><br><br>
      备注：<el-input type="text" v-model="recharge.remark"style="width: 300px"></el-input><br><br>

      <div v-if="title=='充值'">\
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addStudent">确 定</el-button>
      </div>
      <div v-else>
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="updateStudent">修 改</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "index",
    data() {
      return {
        title: '充值',
        dialogVisible: false,
        rechargeList: [],
        recharge: {
          id:'',
          doctorname:'',
          patientname: '',
          money:'',
          status:'',
          phone:'',
          remark:''
        },
        rechargeform: {
          doctorname: '',
          patientname:'',
          startTime:'',
        },
      }
    },
    methods: {
      newrecharge: function () {
        this.title = "充值";
        this.dialogVisible = true;
      },
    }
  }
</script>

<style scoped>

</style>
